﻿package mortal.game.net.command.copy.challengeCopy
{
    import Framework.MQ.*;
    import Message.Command.*;
    import Message.Public.*;
    import mortal.game.cache.*;
    import mortal.game.mvc.*;
    import mortal.game.net.broadCast.*;
    import mortal.game.resource.tableConfig.*;
    import mortal.game.view.copy.ChallengeCopy.*;
    import mortal.game.view.copy.ChallengeCopy.data.*;
    import mortal.mvc.core.*;

    public class ChallengeCopyCommand extends BroadCastCall
    {

        public function ChallengeCopyCommand(param1:Object)
        {
            super(param1);
            return;
        }// end function

        override public function call(param1:MessageBlock) : void
        {
            var _loc_2:ChallengeCopyCache = null;
            var _loc_3:SPlayerChallengeInfos = null;
            var _loc_4:SChallengeCopyRewards = null;
            var _loc_5:ChallengeData = null;
            var _loc_6:SChallengeCopyRewards = null;
            var _loc_7:ChallengeData = null;
            var _loc_8:SChallengeCopyTotalTime = null;
            var _loc_9:SChallengeMopRewardMsg = null;
            _loc_2 = Cache.instance.copy.challengCopy;
            switch(param1.messageHead.command)
            {
                case EPublicCommand._ECmdPublicChallengeCopyInfo:
                {
                    _loc_3 = param1.messageBase as SPlayerChallengeInfos;
                    _loc_2.residuettimes = _loc_3.residuettimes;
                    _loc_2.updateChallengInfo(_loc_3.challengeCopyInfo);
                    _loc_2.isMop = _loc_3.mop;
                    NetDispatcher.dispatchCmd(ServerCommand.ChallengInfoUpdate, null);
                    break;
                }
                case EPublicCommand._ECmdPublicChallengeFail:
                {
                    _loc_4 = param1.messageBase as SChallengeCopyRewards;
                    _loc_5 = Cache.instance.copy.challengCopy.getDataByTowerAndSection(_loc_4.result.floor, _loc_4.result.level);
                    _loc_2.residuettimes = _loc_4.result.residuetimes;
                    NetDispatcher.dispatchCmd(ServerCommand.ChallengeRewardInfo, _loc_4);
                    break;
                }
                case EPublicCommand._ECmdPublicChallengeRewards:
                {
                    _loc_6 = param1.messageBase as SChallengeCopyRewards;
                    _loc_7 = Cache.instance.copy.challengCopy.getDataByTowerAndSection(_loc_6.result.floor, _loc_6.result.level);
                    _loc_7.tChallengCopy = ChallengeCopyConfig.instance.getDataByTowerAndSectionAndDif(_loc_6.result.floor, _loc_6.result.level, _loc_6.result.diff);
                    _loc_7.passLevel = _loc_7.tChallengCopy.level;
                    _loc_2.residuettimes = _loc_6.result.residuetimes;
                    NetDispatcher.dispatchCmd(ServerCommand.ChallengeRewardInfo, _loc_6);
                    break;
                }
                case EPublicCommand._ECmdPublicChallengeTime:
                {
                    _loc_8 = param1.messageBase as SChallengeCopyTotalTime;
                    NetDispatcher.dispatchCmd(ServerCommand.ChalengePanelShow, _loc_8);
                    break;
                }
                case EPublicCommand._ECmdPublicChallengeMopReward:
                {
                    _loc_9 = param1.messageBase as SChallengeMopRewardMsg;
                    _loc_2.isMop = true;
                    NetDispatcher.dispatchCmd(ServerCommand.ChallengMopSuccess, _loc_9);
                    break;
                }
                default:
                {
                    break;
                }
            }
            return;
        }// end function

    }
}
